package javaJob.exercise.primary.math;

import java.util.Arrays;
import java.util.List;

public class primary39_answer {
    public List<String> fizzBuzz(int n) {
        String[] arr = new String[n];
        String a ="FizzBuzz";
        String b = "Fizz";
        String c = "Buzz";
        while(n > 0){
            if (n% 5 == 0){
                if (n % 3 == 0){
                    arr[--n] = a;
                    continue;
                }
                arr[--n] = c;
                continue;
            }
            if (n % 3 == 0){
                arr[--n] = b;
                continue;
            }
            arr[--n] = String.valueOf(++n);
            n--;
        }
        return Arrays.asList(arr);
    }
}
